// $(function () {
const rechargeAnswer = function rechargeAnswer(
  mychart,
  tradeCabinetonLine,
  fullCabinetonLine,
  chargingPileonLine,
  pileBgc,
  tankBgc,
  electricBgc
) {
  const colorList = ["#00dc50", "orange", "#40a2e5"];

  mychart.setOption({
    title: {
      text: "充电占比",
      x: "center",
      y: "43%",
      textStyle: {
        fontSize: 18,
        color: "#fff",
      },
    },
    tooltip: {
      trigger: "item",
    },
    series: [
      {
        type: "pie",
        center: ["50%", "50%"],
        radius: ["50%", "65%"],

        clockwise: true,
        avoidLabelOverlap: true,
        hoverOffset: 3,
        itemStyle: {
          normal: {
            color: function (params) {
              return colorList[params.dataIndex];
            },
          },
        },
        label: {
          show: true,
          position: "outside",
          formatter: "{d}%",
          fontSize: 20,
        },
        labelLine: {
          normal: {
            length: 10,
            length2: 10,
            lineStyle: {
              width: 1,
            },
          },
        },
        data: [
          {
            name: pileBgc, // 充电桩
            value: chargingPileonLine,
          },
          {
            name: tankBgc, //充电柜
            value: fullCabinetonLine,
          },
          {
            name: electricBgc, // 换电柜
            value: tradeCabinetonLine,
          },
        ],
      },
    ],
  });
};
export default rechargeAnswer;

// var rechargeAnswer = echarts.init($('.rechargeAnswer #answerPicture')[0])
// rechargeAnswer.setOption(option)
// })
